#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int singleNumber(vector<int>& nums) {
        vector<int> res;
        sort(nums.begin(), nums.end());
        size_t i = 0;
        for (; i < nums.size() - 1;)
        {
            if (nums[i] == nums[i + 2])
            {
                i += 3;
            }
            else
            {
                return nums[i];
            }
        }
        return nums[i];
    }
};